﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace KTV
{
    public partial class Add : Form
    {
        public Add()
        {
            InitializeComponent();
        }

        private void AddSong_Click(object sender, EventArgs e)
        {
            string sql = string.Format("insert into Song (songName,songType,singer) values ('{0}','{1}','{2}')"
                                , SName.Text, SType.Text, SSinger.Text);

            bool result = DBHelper.Nonquery(sql);
            if (result == true)
            {
                MessageBox.Show("添加成功!");
            }
        }

        private void SName_TextChanged(object sender, EventArgs e)
        {

        }

        private void SSinger_MouseCaptureChanged(object sender, EventArgs e)
        {
            /*string singer = SSinger.Text;

            if (singer == "")
            {
                MessageBox.Show("演唱者不能为空！", "非空验证");
                

            }*/


        }

        private void ReSet_Click(object sender, EventArgs e)
        {
            SName.Text = "";
            SSinger.Text = "";
        }
        //歌名不能为空
        private void SName_MouseCaptureChanged(object sender, EventArgs e)
        {
            string name = SName.Text;
            if (name == "")
            {
                MessageBox.Show("歌名不能为空！", "非空验证");
                SName.Focus();

            }


        }

        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
